<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>平面转换-平移</title>
  <style>
    .box1,
    .box2 {
      margin: 80px auto;
      width: 320px;
      height: 420px;
      background-color: #d8d8d8;
      background-image: url(../../素材/images/dog1.webp);
      background-repeat: no-repeat;
      background-size: contain;
    }

    .box {
      transition: all .5s;
    }

    .box1:hover {
      cursor: pointer;
      transform: translate(0, -8px);
    }

    .box2 {
      overflow: hidden;
    }

    .box2>.mask {
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, .35);
      transition: all .5s;
    }

    .box2:hover .mask {
      cursor: pointer;
      transform: translate(0, 420px);
    }
  </style>
</head>

<body>
  <div class="box1"></div>
  <div class="box2">
    <div class="mask"></div>
  </div>
</body>

</html>